<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="common/include :: header('新增员工')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-employee-edit" th:object="${employee}">
		<input name="id" type="hidden" th:field="*{id}">
		<div class="form-group">
			<label class="col-sm-3 control-label">姓名：</label>
			<div class="col-sm-8">
				<input name="name" class="form-control" type="text" required th:field="*{name}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">邮箱：</label>
			<div class="col-sm-8">
				<input name="email" class="form-control" type="text" required th:field="*{email}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">入职时间：</label>
			<div class="col-sm-8">
				<div class="input-group date">
					<input name="hiredate" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text" th:field="*{hiredate}" required>
					<span class="input-group-editon"><i class="fa fa-calendar"></i></span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">年龄：</label>
			<div class="col-sm-8">
				<input name="age" class="form-control" type="text" th:field="*{age}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">是否超级管理员：</label>
			<div class="col-sm-8">
				<div class="radio-box" th:each="dict : ${@dict.getType('is_admin')}" th:field="*{admin}">
					<input type="radio" th:id="${dict.id}" name="admin" th:value="${dict.value}" th:checked="${dict.isDefault}">
					<label th:for="${dict.id}" th:text="${dict.label}"></label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">是否冻结：</label>
			<div class="col-sm-8">
				<div class="radio-box" th:each="dict : ${@dict.getType('is_freeze')}">
					<input type="radio" th:field="*{status}" th:id="${dict.id}" name="status" th:value="${dict.value}" th:checked="${dict.isDefault}">
					<label th:for="${dict.id}" th:text="${dict.label}"></label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label for="department" class="col-sm-2 control-label">部门：</label>
			<div class="col-sm-6">
				<select class="form-control" id="department" name="deptId" th:field="*{deptId}" >
					<option th:each="department:${departments}"
							th:value="${department.id}"
							th:text="${department.name}"
							>
					</option>
				</select>
			</div>
		</div>
	</form>
</div>
<th:block th:include="common/include :: footer" />
<th:block th:include="common/include :: datetimepicker" />
<script th:inline="javascript">
	var prefix = ctx + "/business/employee"
	$("#form-employee-edit").validate({
		rules:{
			customerPhone:{
				isPhone:true
			}
		},
		messages: {
			"customerPhone":"手机格式不正确"
		},
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/edit", $('#form-employee-edit').serialize());
		}
	}

	$("input[name='hireadate']").datetimepicker({
		format: "yyyy-mm-dd hh:ii",
		autoclose: true
	});
</script>
</body>
</html>